home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / System7 tools / M / Mini Grinders™ 1.0.cpt / Lock It! < prev    next >
Text File  |  1991-03-01  |  633b  |  33 lines

  1. program LockIt;
  2.  
  3. const
  4.     lockBit = 15;
  5.     
  6. var
  7.     fMessage: integer;
  8.     fCount: integer;
  9.     fLoop: integer;
  10.     fileInfo: AppFile;
  11.     fFndrInfo: FInfo
  12.  
  13. begin
  14.     CountAppFiles(fMessage, fCount);
  15.     if (fCount > 0) then
  16.         begin
  17.             for fLoop:= 1 to fCount do
  18.                 begin
  19.                     GetAppFiles(fLoop, fileInfo);
  20.                     error:= GetFInfo(fileInfo.fName, fileInfo.vRefNum, fFndrInfo);
  21.                     if (error <> noErr) then
  22.                         begin
  23.                             if (BTst(fFndrInfo.fdFlags, lockBit)) then
  24.                                 RstFLock(fileInfo.fName, fileInfo.vRefNum)
  25.                             else
  26.                                 SetFLock(fileInfo.fName, fileInfo.vRefNum);
  27.                         end;
  28.                     ClrAppFiles(fLoop);
  29.                 end;
  30.         end
  31.     else
  32.         SysBeep(1);
  33. end.